#ifndef __CC2500SPI_H__
#define __CC2500SPI_H__
#include <avr/interrupt.h>
#include <avr/io.h>
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "CC2500.h"

#ifdef __CC2500SPI_SRC__
	#define SEL_HI()		PORTB |= _BV(PB2)
	#define SEL_LO()		PORTB &= ~_BV(PB2)
	#define SPI_WAIT()		while (!(SPSR & (1<< SPIF)))
	// CC2500 ״̬
	#define CCxxx0_Ready()	PINB & _BV(PB4)
#else
	extern void SPI_Master_Init();
	extern void halSpiStrobe(uint8_t);
	extern uint8_t halSpiReadReg(uint8_t);
	extern void halSpiWriteReg(uint8_t, uint8_t);
	extern void halSpiWriteBurstReg(uint8_t addr, uint8_t *buffer, uint8_t count);
	extern void halSpiReadBurstReg(uint8_t addr, uint8_t *buffer, uint8_t count);
	extern uint8_t halSpiReadStatus(uint8_t addr);
	extern void RESET_CCxxx0();
	extern void POWER_UP_RESET_CCxxx0();
	extern void halRfSendPacket(uint8_t *txBuffer, uint8_t size);
#endif
#endif
